Pantheon documentation on bypassing cache

I’m looking at this page:

And I’m trying to understand what the # characters are in regex path patterns in the code example. Doesn’t # just match a literal # character in a regex? When would that ever be part of the path reported by $_SERVER['REQUEST_URI']?

If I’m trying to match a path that starts with /news/, isn’t the correct regex ^/news/? and not #^/news/?#?

1 Like

Hi Michael, I believe, in that code example, the # characters are being used as the delimiter for the regular expressions and are not actually part of the matching expression.

I also found this from Googling:

That said, there’s more than one type of delimiter that you can use. It depends on the syntax that your programming language uses. For example, PCRE (which is the syntax that PHP uses) also supports the following delimiters:

  • Hashtags ( # )
  • Percentage signs ( % )
  • Plus signs ( + )
  • Tildes ( ~ )
1 Like

Ohhh, I see. So the #...# characters are basically just taking the place of the more typical /.../ delimiter characters? I had no idea it was possible to use different delimiters in regular expressions! That makes sense. Even after all these years, I’m still learning new things about regex. Thanks for your help!


Sorry we missed this! Looks like @aaron was able to pop in here and help :slight_smile: Thanks Aaron!